/**
 余额记录
 */

layui.define(['form', 'table'], function (exports) {
    var $ = layui.$, table = layui.table;
    var tableIn = table.render({
        elem: "#list",
        url: "/shengteng/Wallet/moneyList",
        toolbar: "#toolbar",
        defaultToolbar: [],
        title: "提现记录",
        cols: [[
            {field: 'id', title: 'ID', width: 80, fixed: 'left', unresize: true},
            {field: 'username', title: '会员名称', width: 200},
            {field: 'mobile', title: '电话', width: 220},
            {field: 'type_text', title: '变动类型', width: 100},
            {field: 'money', title: '变动金额', width: 100},
            {field: 'extra', title: '备注', width: 100},
            {field: 'create_time', title: '变动时间', width: 220},
            {field: 'after_money', title: '变动后金额', width: 100},
        ]],
        page: true
    })

    var active = {
        reload: function () {
            var key = $('#key').val();
            var log_type = $('#log_type').val();
            //执行重载
            table.reload('list', {
                page: {
                    curr: 1 //重新从第 1 页开始
                }
                , where: {
                    key: key,
                    log_type:log_type
                }
            });
        }
    };

    $('.table-head-btn .layui-btn').on('click', function () {
        var type = $(this).data('type');
        active[type] ? active[type].call(this) : '';
    });

    //对外暴露的接口
    exports('money_log', {});
});
